<template>
  <view class="lists">
    <scroll-view :scroll-into-view="scrollId" scroll-y="true" class="scroll-Y scroll" id="view1">
      <view class="card itemName1" id="height"> </view>
      <view class="card itemName2" id="weight"> </view>
      <view class="card itemName3" id="bmi"> </view>
      <view class="card itemName4" id="whr"> </view>
      <view class="card itemName5" id="sbp"> </view>
      <view class="card itemName6" id="heart_rate"> </view>
      <view class="card itemName6" id="fbg"> </view>
      <view class="card itemName6" id="spo2"> </view>
    </scroll-view>
  </view>
</template>

<script setup lang="ts">
import { ref, reactive, nextTick } from 'vue'
import { onLoad, onShow } from '@dcloudio/uni-app'

const type = ref('')
const userInfo = ref({})
const scrollId = ref('')

onLoad((option) => {
  type.value = option.type ? option.type : ''
})
onShow(() => {
  userInfo.value = JSON.parse(uni.getStorageSync('userInfo')).patientInfo

  nextTick(() => {
    scrollId.value = type.value
  })
})
</script>

<style lang="scss" scoped>
.lists {
  padding: 24rpx 32rpx;
  background: pink;
  .scroll-Y {
    height: 100vh;
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
  }
  .card {
    height: 300rpx;
    background: red;
    margin-top: 40rpx;
    &:nth-child(1) {
      margin-top: 0;
    }
    &:nth-child(2) {
      background: gold;
    }
    &:nth-child(3) {
      background: fuchsia;
    }
    &:nth-child(4) {
      background: green;
    }
    &:nth-child(5) {
      background: yellow;
    }
    &:nth-child(6) {
      background: gray;
      height: 1600rpx;
    }
  }
}
</style>
